package BeenChina.PM.Service.Impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import BeenChina.PM.DAO.BaseInfoDao;
import BeenChina.PM.DAO.CaseRankInfoDao;
import BeenChina.PM.Model.ModelBaseInfo; 
import BeenChina.PM.Model.ModelCaseRankInfo;
import BeenChina.PM.Model.ModelEmpInfoUnitWorkEmp;
import BeenChina.PM.Model.ModelEmpInfoWorkEmp;
import BeenChina.PM.Service.BaseInfoService;

public class BaseInfoServiceImpl implements BaseInfoService{
 
	  private BaseInfoDao dao;
	  private CaseRankInfoDao caseRankInfoDao;

	   
	     public void setCaseRankInfoDao(CaseRankInfoDao caseRankInfoDao) {
	    	this.caseRankInfoDao = caseRankInfoDao;
	    } 

		public void setDao(BaseInfoDao dao) {
	        this.dao = dao;
	    }
	    
	    public List<ModelBaseInfo> selectBaseInfos(String caseName,String rankID,String dateFrom,String dateTo,String dateField){   
 			try{			 
				Map<String, String> params = new HashMap<String, String>();
				params.put("caseName", caseName);
				params.put("rankID", rankID);
				params.put("dateFrom", dateFrom);
				params.put("dateTo", dateTo);
				params.put("dateField", dateField);

				return this.dao.selectBaseInfos( params);
			 } catch (Exception e) {  
	             e.printStackTrace();  
	             return null;
	         }  
	    }

		@Override
		public List<ModelEmpInfoWorkEmp> selectEmpInfoWorkEmp(String dateFrom,
				String dateTo) {
			try{			 
				Map<String, String> params = new HashMap<String, String>(); 
				params.put("dateFrom", dateFrom);
				params.put("dateTo", dateTo); 

				return this.dao.selectEmpInfoWorkEmp(params);
			 } catch (Exception e) {  
	             e.printStackTrace();  
	             return null;
	         }  
		}

		@Override
		public List<ModelEmpInfoUnitWorkEmp> selectEmpInfoUnitWorkEmp(
				String dateFrom, String dateTo) {
		 
			try{			 
				Map<String, String> params = new HashMap<String, String>(); 
				params.put("dateFrom", dateFrom);
				params.put("dateTo", dateTo); 

				return this.dao.selectEmpInfoUnitWorkEmp(params);
			 } catch (Exception e) {  
	             e.printStackTrace();  
	             return null;
	         }  
		}

		@Override
		public List<ModelCaseRankInfo> selectCaseRankInfo() {
			 
			try{ 
				return this.caseRankInfoDao.selectCaseRankInfo();
			 } catch (Exception e) {  
	             e.printStackTrace();  
	             return null;
	         }  
		}	    
	    
	   
}
